<template>
<div class="swiper-container">
    <div class="swiper-wrapper">
        <div class="swiper-slide" v-for="(img,index) in bannerList" :key="index">
            <span :style="{backgroundImage:'url('+img.imgUrl+')'}"></span>
        </div>
    </div>

    <div class="swiper-button-next"></div>
    <div class="swiper-button-prev"></div>
    <div class="swiper-pagination"></div>
</div>
</template>
<script>
import Swiper from 'swiper'

export default {
    name: 'HeaderTop',
    data:function(){
        return {
            bannerList:[
                {imgUrl:'/images/banner/1.jpg'},
                {imgUrl:'/images/banner/2.jpg'},
                {imgUrl:'/images/banner/3.jpg'}
            ]
        }
    },
    mounted() {
        // 下面是普通swiper模板
        new Swiper(".swiper-container", {
            loop: true,
            mousewheel: false,
            keyboard: true,

            navigation: {
                nextEl: ".swiper-button-next",
                prevEl: ".swiper-button-prev",
            },

            pagination: {
                el: ".swiper-pagination",
            },                    
        });
    }

}

</script>
<style>
.swiper-wrapper{
    position:relative;
    text-align:center;
    height: 38px;
}
.swiper-wrapper span{
    display:block;width:100%;height:380px;background-repeat:no-repeat;background-position:center center;
}
</style>